package com.heima.feigns.article;

import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.ArticleFeignFallback;
import com.heima.model.admin.dtos.ResponseResult;
import com.heima.model.article.pojos.ApAuthor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient( value = "article-service",
        fallbackFactory = ArticleFeignFallback.class,
        configuration = HeimaFeignAutoConfiguration.class
)
public interface ArticleFeign {

        //远程调用   抽取article-service模块的接口
    @GetMapping("/api/v1/author/findByUserId/{id}")
    public ResponseResult<ApAuthor> findByUserId(@PathVariable("userId") Integer userId);

    @PostMapping("/api/v1/author/save")
    public ResponseResult<ApAuthor> saveAuthor(@RequestBody ApAuthor apAuthor);
}
